package com.example.tablistfractionzlw1002.slice;
import com.example.tablistfractionzlw1002.ResourceTable;
import ohos.aafwk.ability.fraction.Fraction;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.ListContainer;
import java.util.ArrayList;
import java.util.List;

public class Fration_one  extends Fraction {
    int[] newsPics = new int[]{
            ResourceTable.Media_dj1,
            ResourceTable.Media_dj2,
            ResourceTable.Media_dj3,
            ResourceTable.Media_dj4,
            ResourceTable.Media_dj5,
            ResourceTable.Media_dj6,
            ResourceTable.Media_dj7,
            ResourceTable.Media_dj8};
    String[] newsTitles = new String[]{
            "中国共产党是为人民奋斗的政党",
            "党的伟大精神永远是党和国家的宝贵精神财富",
            "推动新时代党的民族工作高质量发展",
            "坚定不移走中国特色解决民族问题的正确道路",
            "以铸牢中华民族共同体意识为主线 推动新时代党的民族工作高质量发展",
            "坚持不懈为群众办实事做好事（奋斗百年路 启航新征程·学党史 悟思想 办实事 开新局）",
            "中国共产党的历史使命与行动价值",
            "广大干部新征程上奋力担当作为"};
    @Override
    protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        Component pare=scatter.parse(ResourceTable.Layout_fratino_one,null,false);
        ListContainer listContainer = (ListContainer) pare.findComponentById(ResourceTable.Id_listcontainer);
        List<Itme>itmes=new ArrayList<>();
        List<newsdate_neirong> totalNews=new ArrayList<>();
        for (int i=0;i<newsPics.length;i++){
            Itme itme=new Itme(newsPics[i],newsTitles[i]);
            itmes.add(itme);
        }
        listContainer.setItemProvider(new NEW_porive(itmes,this));
        return pare;
    }

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
    }
}
